# -----------------------------------------------------------------
# set resedit variable

set(resedit_name "@RESEDIT_NAME@")
set(resedit_version "@RESEDIT_VERSION@")
set(resedit_binary_dir "@RESEDIT_BINARY_DIR@")
set(resedit_source_dir "@RESEDIT_SOURCE_DIR@")

# --------------------------------------------------------------------------
# Exit codes

set(EXIT_SUCCESS 0)
set(EXIT_FAILURE 1)

# --------------------------------------------------------------------------
# Recover the Build Type
set(build_types
  "Debug"
  "MinSizeRel"
  "Release"
  "RelWithDebInfo"
  )
foreach (type ${build_types})
  if(EXISTS ${resedit_binary_dir}/${type}/${resedit_name}.exe)
    set(resedit_build_type ${type})
  endif()
endforeach()
if(NOT resedit_build_type)
  message(FATAL_ERROR "No build type find - Type : ${resedit_build_type}")
endif()

set(resedit_dir ${resedit_binary_dir}/${resedit_build_type})
set(resedit_exe ${resedit_dir}/${resedit_name}.exe)

# --------------------------------------------------------------------------
# Check if resedit exists
if (NOT EXISTS ${resedit_exe})
  message(FATAL_ERROR "Application ${resedit_exe} doesn't exists !")
endif()

# --------------------------------------------------------------------------
# Set application variable

set(App4Test_Dir "${resedit_binary_dir}/Testing/${resedit_build_type}")
set(App4Test_Name App4Test)
set(App4Test_Path ${App4Test_Dir}/${App4Test_Name}.exe)

# --------------------------------------------------------------------------
# Check if application exists

if (NOT EXISTS ${App4Test_Path})
  message(FATAL_ERROR "Application ${App4Test_Path} doesn't exists !")
endif()

# --------------------------------------------------------------------------
# Set application without resource variable

set(App4Test_WR_Dir "${resedit_binary_dir}/Testing/${resedit_build_type}")
set(App4Test_WR_Name App4Test_Without_Resource)
set(App4Test_WR_Path ${App4Test_WR_Dir}/${App4Test_WR_Name}.exe)

# --------------------------------------------------------------------------
# Check if application exists

if (NOT EXISTS ${App4Test_WR_Path})
  message(FATAL_ERROR "Application ${App4Test_WR_Path} doesn't exists !")
endif()

# --------------------------------------------------------------------------
# Set Resources variable

set(ResourceIco1_Name "Creative-Suite")
set(ResourceIco1_Path "${resedit_source_dir}/Testing/Resources/${ResourceIco1_Name}.ico")
set(ResourceIco2_Name "icon1")
set(ResourceIco2_Path "${resedit_source_dir}/Testing/Resources/${ResourceIco2_Name}.ico")
set(ResourceBitMap_Name "delete-icon")
set(ResourceBitMap_Path "${resedit_source_dir}/Testing/Resources/${ResourceBitMap_Name}.bmp")

# --------------------------------------------------------------------------
# Check if Resources exist

if (NOT EXISTS ${ResourceIco1_Path})
  message(FATAL_ERROR "Application ${ResourceIco1_Path} doesn't exists !")
endif()
if (NOT EXISTS ${ResourceIco2_Path})
  message(FATAL_ERROR "Application ${ResourceIco2_Path} doesn't exists !")
endif()
if (NOT EXISTS ${ResourceBitMap_Path})
  message(FATAL_ERROR "Application ${ResourceBitMap_Path} doesn't exists !")
endif()

